<template>
	<view class="news_item">
		<view class="header">
			<view class="header-icon">
				<image src="../../static/icon/back.png" style="width: 40rpx;height: 40rpx;" @click="back"></image>
			</view>
			<view class="newsTitle">
				{{association_info.name}}
			</view>
		</view>
		<view class="content">

			<view class="info">
				成立时间：
				<uni-dateformat :date="association_info.dateOfEstablishment " :format="'yyyy'+'年'+'MM'+'月'+'dd'+'日'"
					style="margin-left: -180rpx;" />
				<text>负责人：{{association_info.principal}}</text>
			</view>
			<view class="">
				<view class="title">协会简介</view>
				<view class="imgContent">
					<view class="tit" v-html="association_info.introduction" style="text-indent: 2rem;" />
				</view>
			</view>
			<view style="margin: 5rpx 10rpx;">
				<image :src="association_info.logoUrl" style="width: 100%;margin-bottom: 20rpx;"></image>
			</view>
			<view class="">
				<view class="title">联系我们</view>
				<view class="imgContent">
					<view class="tit">
						联系人：{{association_info.contact}}
					</view>
					<view class="tit">
						联系电话：{{association_info.phone}}
					</view>
					<view class="tit">
						地址：{{association_info.address}}
					</view>
					<view class="tit">
						官网地址：{{association_info.url}}
					</view>
				</view>
			</view>
		</view>
		<!-- 回到顶部 -->
		<view class="wrap">
			<u-back-top :scroll-top="scrollTop"></u-back-top>
		</view>
	</view>
</template>

<script>
	export default {
		//过滤时间
		filters: {
			formatDate(date) {
				const nDate = new Date(date)
				const year = nDate.getFullYear()
				const month = nDate.getMonth().toString().padStart(2, 0)
				const day = nDate.getDate().toString().padStart(2, 0)
				return year + '-' + month + '-' + day
			}
		},
		data() {
			return {
				id: 0,
				serviceList: [],
				// 回到顶部样式
				scrollTop: 0,
				mode: "square",
				iconStyle: {
					fontSize: "32rpx",
					color: "#2979ff",
				},
				association_info: {},
				article_content: ''

			}
		},
		onLoad(options) {
			this.id = options.id
			this.getDetailList()
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		methods: {
			//获取协会详情
			getDetailList() {
				const that = this
				that.$api.request('association', 'detail', {
					associationId: this.id
				}).then(res => {
					this.association_info = res.data
				})
			},
			// 返回
			back() {
				const pages = getCurrentPages()
				if (pages && pages.length > 1) {
					uni.navigateBack({
						delta: 1
					})
				} else {
					history.go(-1)
				}
			}
		}
	}
</script>

<style lang="scss">
	.header {
		width: 100%;
		display: flex;
		padding: 50px 0 10px 0;
		position: fixed;
		background-color: #fff;
		.header-icon {
			padding: 20rpx;
		}

		.newsTitle {
			padding-top: 18rpx;
			font-size: 35rpx;
			font-weight: bolder;
			display: flex;
			justify-content: center;
			flex-wrap: wrap;
			width: 80%;
		}
	}

	.title {
		font-size: 38rpx;
		font-weight: 500;
		letter-spacing: 0.5rem;
		border-left: 4rpx solid orangered;
		padding-left: 30rpx;
	}

	.imgContent {
		padding: 10rpx 30rpx;

		.tit {
			line-height: 1.7;
			margin-bottom: 20rpx;
			color: #666;
		}
	}

	.news_item {
		.content {
			height: 100%;
			padding: 220rpx 20rpx 0;
		}

		.info {
			font-size: 25rpx;
			justify-content: space-between;
			display: flex;
			padding: 20rpx 26rpx 20rpx 0;
			color: #999999;

			text:nth-child(2) {
				margin-left: 30rpx;
			}
		}
	}
</style>
